import { loadLocaleMessages } from '@/locales/setup/index'

const useI18nStore = defineStore('i18n', {
  state: () => ({
    currentLocale: 'zh-CN',
  }),
  actions: {
    // 设置当前语言
    setCurrentLocale(value: string) {
      this.currentLocale = value
      loadLocaleMessages(value as any);
    },
  },
  persist: true 
})

export default useI18nStore
